import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },

  {
    path: '/certDetail',
    component: () => import('@/views/certificate/detail'),
    hidden: true
  },

  {
    path: '/certElectron',
    component: () => import('@/views/certificate/electorn'),
    hidden: true
  },

  {
    path: '/certinfo',
    component: () => import('@/views/certificate/detailinfo'),
    hidden: true
  },

  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [{
      path: 'dashboard',
      name: 'Dashboard',
      component: () => import('@/views/dashboard/index'),
      meta: { title: '首页', icon: 'el-icon-s-home' }
    }]
  },

  // {
  //   path: '/administrators',
  //   component: Layout,
  //   redirect: '/administrators/list',
  //   name: 'administrators',
  //   meta: { title: '管理员设置', icon: 'el-icon-s-custom' },
  //   children: [
  //     {
  //       path: 'list',
  //       name: 'AdministratorsList',
  //       component: () => import('@/views/administrators/index'),
  //       meta: { title: '管理员列表', icon: 'table' }
  //     },
  //     {
  //       path: 'add',
  //       name: 'AdministratorsAdd',
  //       component: () => import('@/views/administrators/add'),
  //       meta: { title: '新增管理员', icon: 'el-icon-circle-plus-outline', activeMenu: '/administrators/list' },
  //       hidden: true,
  //     },
  //     {
  //       path: 'edit',
  //       name: 'AdministratorsEdit',
  //       component: () => import('@/views/administrators/edit'),
  //       meta: { title: '编辑管理员', icon: 'el-icon-edit', activeMenu: '/administrators/list' },
  //       hidden: true,
  //     }
  //   ]
  // },

  // {
  //   path: '/certificate',
  //   component: Layout,
  //   redirect: '/certificate/IAOA',
  //   name: 'certificate',
  //   meta: { title: '证书管理', icon: 'el-icon-document' },
  //   alwaysShow: true,
  //   children: [
  //     {
  //       path: 'IAOA',
  //       name: 'certificateIAOA',
  //       component: () => import('@/views/certificate/IAOA'),
  //       meta: { title: 'IAOA', icon: 'el-icon-document' },
  //     },
  //   ]
  // },

  // {
  //   path: '/cert',
  //   component: Layout,
  //   redirect: '/cert/list',
  //   name: 'cert',
  //   meta: {
  //     title: '证书管理（测试）',
  //     icon: 'el-icon-news'
  //   },
  //   children: [
  //     {
  //       path: 'list',
  //       name: 'certList',
  //       component: () => import('@/views/cert/index'),
  //       meta: {
  //         title: '证书列表',
  //         icon: 'table'
  //       }
  //     },
  //     {
  //       path: 'classify',
  //       name: 'certClassify',
  //       component: () => import('@/views/cert/classify'),
  //       meta: {
  //         title: '证书系列',
  //         icon: 'el-icon-collection-tag'
  //       }
  //     }
  //   ]
  // },

  // {
  //   path: '/operate',
  //   component: Layout,
  //   redirect: '/operate/message',
  //   name: 'operate',
  //   alwaysShow: true,
  //   meta: { title: '运营管理', icon: 'el-icon-s-flag' },
  //   children: [
  //     {
  //       path: 'message',
  //       name: 'operateMessage',
  //       component: () => import('@/views/operate/message'),
  //       meta: { title: '短信群发' }
  //     }
  //   ]
  // },

  // {
  //   path: '/tool',
  //   component: Layout,
  //   redirect: '/tool/list',
  //   name: 'tool',
  //   alwaysShow: true,
  //   meta: { title: '工具管理', icon: 'el-icon-s-tools' },
  //   children: [
  //     {
  //       path: 'list',
  //       name: 'toolList',
  //       component: () => import('@/views/tool/list'),
  //       meta: { title: '验配工具' }
  //     }
  //   ]
  // },

  {
    path: '/users',
    component: Layout,
    redirect: '/users/list',
    name: 'users',
    meta: { title: '用户管理', icon: 'el-icon-user-solid' },
    children: [
      {
        path: 'list',
        name: 'UsersList',
        component: () => import('@/views/users/index'),
        meta: { title: '用户管理', icon: 'el-icon-user-solid' }
      },
      {
        path: 'edit',
        name: 'UsersEdit',
        component: () => import('@/views/users/edit'),
        meta: { title: '编辑管理员', icon: 'el-icon-edit', activeMenu: '/users/list' },
        hidden: true,
      }
    ]
  },

  {
    path: '/banner',
    component: Layout,
    redirect: '/banner/list',
    name: 'Banner',
    meta: {
      title: '轮播管理',
      icon: 'el-icon-picture-outline',
    },
    children: [
      {
        path: 'list',
        name: 'bannerList',
        component: () => import('@/views/banner/index'),
        meta: {
          title: '轮播管理',
          icon: 'el-icon-picture-outline'
        }
      },
      {
        path: 'edit',
        name: 'bannerEdit',
        component: () => import('@/views/banner/edit'),
        meta: {
          title: '编辑轮播图',
          icon: 'el-icon-picture-outline',
          activeMenu: '/banner/list'
        },
        hidden: true,
      },
      {
        path: 'add',
        name: 'bannerAdd',
        component: () => import('@/views/banner/add'),
        meta: {
          title: '新建轮播图',
          icon: 'el-icon-picture-outline',
          activeMenu: '/banner/list'
        },
        hidden: true,
      }
    ]
  },

  {
    path: '/news',
    component: Layout,
    redirect: '/news/list',
    name: 'News',
    meta: {
      title: '跑友故事',
      icon: 'el-icon-news',
    },
    children: [
      {
        path: 'list',
        name: 'newsList',
        component: () => import('@/views/news/index'),
        meta: {
          title: '跑友故事',
          icon: 'table'
        }
      },
      {
        path: 'add',
        name: 'newsAdd',
        component: () => import('@/views/news/add'),
        meta: {
          title: '新建故事',
          activeMenu: '/news/list'
        },
        hidden: true,
      },
      {
        path: 'edit',
        name: 'newsEdit',
        component: () => import('@/views/news/edit'),
        meta: {
          title: '编辑故事',
          activeMenu: '/news/list'
        },
        hidden: true,
      },
      // {
      //   path: 'classify',
      //   name: 'newsClassify',
      //   component: () => import('@/views/news/classify'),
      //   meta: {
      //     title: '分类管理',
      //     icon: 'el-icon-collection-tag',
      //   },
      // },
    ]
  },

  {
    path: '/goods',
    component: Layout,
    redirect: '/goods/list',
    name: 'Goods',
    alwaysShow: true,
    meta: {
      title: '售卖商品管理',
      icon: 'el-icon-news'
    },
    children: [
      {
        path: 'list',
        name: 'goodsList',
        component: () => import('@/views/goods/index'),
        meta: {
          title: '商品列表',
          icon: 'table'
        }
      },
      {
        path: 'classify',
        name: 'goodsClassify',
        component: () => import('@/views/goods/classify'),
        meta: {
          title: '分类管理',
          icon: 'el-icon-collection-tag'
        }
      }
    ]
  },

  {
    path: '/marketing',
    component: Layout,
    redirect: '/marketing/order',
    name: 'marketing',
    meta: { title: '营销中心', icon: 'el-icon-document' },
    children: [
      {
        path: 'order',
        name: 'marketingGoods',
        component: () => import('@/views/marketing/order'),
        meta: { title: '订单管理', icon: 'el-icon-document' }
      },
      // {
      //   path: 'coupon',
      //   name: 'marketingCoupon',
      //   component: () => import('@/views/marketing/coupon'),
      //   meta: { title: '优惠券管理', icon: 'el-icon-document' }
      // },
      // {
      //   path: 'addCoupon',
      //   name: 'marketingAddCoupon',
      //   component: () => import('@/views/marketing/addCoupon'),
      //   meta: { title: '新建优惠券', icon: 'el-icon-document' },
      //   hidden: true,
      // },
    ]
  },

  {
    path: '/without',
    component: Layout,
    redirect: '/without/list',
    name: 'widthout',
    meta: { title: '提现管理', icon: 'el-icon-document' },
    children: [
      {
        path: 'setting',
        name: 'widthoutSetting',
        component: () => import('@/views/without/setting'),
        meta: { title: '佣金设置', icon: 'el-icon-document' }
      },
      {
        path: 'list',
        name: 'widthoutManage',
        component: () => import('@/views/without/index'),
        meta: { title: '提现管理', icon: 'el-icon-document' }
      }
    ]
  },

  {
    path: '/activity',
    component: Layout,
    redirect: '/activity/list',
    name: 'Activity',
    meta: {
      title: '活动管理',
      icon: 'el-icon-aim',
    },
    children: [
      {
        path: 'list',
        name: 'activityList',
        component: () => import('@/views/activity/index'),
        meta: {
          title: '活动管理',
          icon: 'el-icon-aim'
        }
      },
      {
        path: 'edit',
        name: 'activityEdit',
        component: () => import('@/views/activity/edit'),
        meta: {
          title: '编辑活动',
          icon: 'el-icon-picture-outline',
          activeMenu: '/activity/list'
        },
        hidden: true,
      },
      {
        path: 'add',
        name: 'activityAdd',
        component: () => import('@/views/activity/add'),
        meta: {
          title: '新建活动',
          icon: 'el-icon-picture-outline',
          activeMenu: '/activity/list'
        },
        hidden: true,
      }
    ]
  },

  // {
  //   path: '/teachers',
  //   component: Layout,
  //   redirect: '/teachers/list',
  //   name: 'teachers',
  //   meta: { title: '教师管理', icon: 'el-icon-s-custom' },
  //   children: [
  //     {
  //       path: 'list',
  //       name: 'TeachersList',
  //       component: () => import('@/views/teachers/index'),
  //       meta: { title: '教师管理', icon: 'el-icon-s-custom' }
  //     },
  //     {
  //       path: 'add',
  //       name: 'TeachersAdd',
  //       component: () => import('@/views/teachers/add'),
  //       meta: { title: '创建教师', icon: 'el-icon-circle-plus-outline', activeMenu: '/teachers/list' },
  //       hidden: true,
  //     },
  //     {
  //       path: 'edit',
  //       name: 'TeachersAdministratorsEdit',
  //       component: () => import('@/views/teachers/edit'),
  //       meta: { title: '编辑教师', icon: 'el-icon-edit', activeMenu: '/teachers/list' },
  //       hidden: true,
  //     }
  //   ]
  // },

  // {
  //   path: '/offline',
  //   component: Layout,
  //   redirect: '/offline/list',
  //   name: 'Offline',
  //   meta: {
  //     title: '线下课管理',
  //     icon: 'el-icon-aim',
  //   },
  //   children: [
  //     {
  //       path: 'list',
  //       name: 'offlineList',
  //       component: () => import('@/views/offline/index'),
  //       meta: {
  //         title: '线下课管理',
  //         icon: 'el-icon-aim'
  //       }
  //     },
  //     {
  //       path: 'edit',
  //       name: 'offlineEdit',
  //       component: () => import('@/views/offline/edit'),
  //       meta: {
  //         title: '编辑线下课',
  //         icon: 'el-icon-picture-outline',
  //         activeMenu: '/offline/list'
  //       },
  //       hidden: true,
  //     },
  //     {
  //       path: 'add',
  //       name: 'offlineAdd',
  //       component: () => import('@/views/offline/add'),
  //       meta: {
  //         title: '新建线下课',
  //         icon: 'el-icon-picture-outline',
  //         activeMenu: '/offline/list'
  //       },
  //       hidden: true,
  //     }
  //   ]
  // },

  {
    path: '/forum',
    component: Layout,
    redirect: '/forum/list',
    name: 'Forum',
    meta: {
      title: '论坛管理',
      icon: 'el-icon-s-help',
    },
    children: [
      {
        path: 'list',
        name: 'forumList',
        component: () => import('@/views/forum/index'),
        meta: {
          title: '主贴管理',
          icon: 'el-icon-chat-round'
        }
      },
      {
        path: 'talk',
        name: 'forumTalk',
        component: () => import('@/views/forum/talk'),
        meta: {
          title: '评论管理',
          icon: 'el-icon-help'
        }
      },
      // {
      //   path: 'topic',
      //   name: 'forumTopic',
      //   component: () => import('@/views/forum/topic'),
      //   meta: {
      //     title: '话题管理',
      //     icon: 'el-icon-chat-line-round',
      //   },
      // },
      // {
      //   path: 'report',
      //   name: 'forumReport',
      //   component: () => import('@/views/forum/report'),
      //   meta: {
      //     title: '举报管理',
      //     icon: 'el-icon-chat-line-round',
      //   },
      // },
      {
        path: 'topicAdd',
        name: 'topicAdd',
        component: () => import('@/views/forum/add'),
        meta: {
          title: '新建话题',
          activeMenu: '/forum/topic',
          icon: 'el-icon-chat-line-round',
        },
        hidden: true,
      },
      {
        path: 'topicEdit',
        name: 'topicEdit',
        component: () => import('@/views/forum/edit'),
        meta: {
          title: '编辑话题',
          activeMenu: '/forum/topic',
          icon: 'el-icon-chat-line-round',
        },
        hidden: true,
      },
    ]
  },

  // {
  //   path: '/video',
  //   component: Layout,
  //   redirect: '/video/list',
  //   name: 'Video',
  //   meta: {
  //     title: '视频号管理',
  //     icon: 'el-icon-s-help',
  //   },
  //   children: [
  //     {
  //       path: 'list',
  //       name: 'videoList',
  //       component: () => import('@/views/video/index'),
  //       meta: {
  //         title: '主贴管理',
  //         icon: 'el-icon-chat-round'
  //       }
  //     },
  //     {
  //       path: 'talk',
  //       name: 'videoTalk',
  //       component: () => import('@/views/video/talk'),
  //       meta: {
  //         title: '评论管理',
  //         icon: 'el-icon-help'
  //       }
  //     },
  //     {
  //       path: 'topic',
  //       name: 'videoTopic',
  //       component: () => import('@/views/video/topic'),
  //       meta: {
  //         title: '话题管理',
  //         icon: 'el-icon-chat-line-round',
  //       },
  //     },
      // {
      //   path: 'report',
      //   name: 'videoReport',
      //   component: () => import('@/views/video/report'),
      //   meta: {
      //     title: '举报管理',
      //     icon: 'el-icon-chat-line-round',
      //   },
      // },
  //     {
  //       path: 'videoAdd',
  //       name: 'videoAdd',
  //       component: () => import('@/views/video/add'),
  //       meta: {
  //         title: '新建话题',
  //         activeMenu: '/video/topic',
  //         icon: 'el-icon-chat-line-round',
  //       },
  //       hidden: true,
  //     },
  //     {
  //       path: 'videoEdit',
  //       name: 'videoEdit',
  //       component: () => import('@/views/video/edit'),
  //       meta: {
  //         title: '编辑话题',
  //         activeMenu: '/forum/topic',
  //         icon: 'el-icon-chat-line-round',
  //       },
  //       hidden: true,
  //     },
  //   ]
  // },

  // {
  //   path: '/subject',
  //   component: Layout,
  //   redirect: '/subject/single',
  //   name: 'subject',
  //   meta: { title: '题目管理', icon: 'el-icon-document' },
  //   children: [
  //     {
  //       path: 'single',
  //       name: 'SingleSubject',
  //       component: () => import('@/views/subject/single'),
  //       meta: { title: '单选题', icon: 'el-icon-document' }
  //     },
  //     {
  //       path: 'double',
  //       name: 'DoubleSubject',
  //       component: () => import('@/views/subject/double'),
  //       meta: { title: '多选题', icon: 'el-icon-document-copy' }
  //     },
  //     {
  //       path: 'judge',
  //       name: 'JudgeSubject',
  //       component: () => import('@/views/subject/judge'),
  //       meta: { title: '判断题', icon: 'el-icon-document-checked' }
  //     },
  //     {
  //       path: 'short',
  //       name: 'ShortSubject',
  //       component: () => import('@/views/subject/short'),
  //       meta: { title: '简答题', icon: 'el-icon-notebook-2' }
  //     },
  //   ]
  // },

  // {
  //   path: '/paper',
  //   component: Layout,
  //   redirect: '/paper/test',
  //   name: 'paper',
  //   meta: { title: '试卷中心', icon: 'el-icon-document' },
  //   children: [
  //     {
  //       path: 'test',
  //       name: 'PaperTest',
  //       component: () => import('@/views/paper/test'),
  //       meta: { title: '练习试卷', icon: 'el-icon-document' }
  //     },
  //     {
  //       path: 'task',
  //       name: 'PaperTask',
  //       component: () => import('@/views/paper/task'),
  //       meta: { title: '作业试卷', icon: 'el-icon-document' }
  //     },
  //     {
  //       path: 'exam',
  //       name: 'PaperExam',
  //       component: () => import('@/views/paper/exam'),
  //       meta: { title: '考试试卷', icon: 'el-icon-document' }
  //     },
  //     {
  //       path: 'testAdd',
  //       name: 'PaperTestAdd',
  //       component: () => import('@/views/paper/testAdd'),
  //       meta: { title: '创建练习试卷', activeMenu: '/paper/test', icon: 'el-icon-document' },
  //       hidden: true,
  //     },
  //     {
  //       path: 'testEdit',
  //       name: 'PaperTestEdit',
  //       component: () => import('@/views/paper/testEdit'),
  //       meta: { title: '编辑练习试卷', activeMenu: '/paper/test', icon: 'el-icon-document' },
  //       hidden: true,
  //     },
  //     {
  //       path: 'taskAdd',
  //       name: 'PaperTastAdd',
  //       component: () => import('@/views/paper/taskAdd'),
  //       meta: { title: '创建作业试卷', activeMenu: '/paper/task', icon: 'el-icon-document' },
  //       hidden: true,
  //     },
  //     {
  //       path: 'taskEdit',
  //       name: 'PaperTastEdit',
  //       component: () => import('@/views/paper/taskEdit'),
  //       meta: { title: '编辑作业试卷', activeMenu: '/paper/task', icon: 'el-icon-document' },
  //       hidden: true,
  //     },
  //     {
  //       path: 'examAdd',
  //       name: 'PaperExamAdd',
  //       component: () => import('@/views/paper/examAdd'),
  //       meta: { title: '创建考试试卷', activeMenu: '/paper/exam', icon: 'el-icon-document' },
  //       hidden: true,
  //     },
  //     {
  //       path: 'examEdit',
  //       name: 'PaperExamEdit',
  //       component: () => import('@/views/paper/examEdit'),
  //       meta: { title: '编辑作业试卷', activeMenu: '/paper/exam', icon: 'el-icon-document' },
  //       hidden: true,
  //     },
  //   ]
  // },

  // {
  //   path: '/course',
  //   component: Layout,
  //   redirect: '/course/list',
  //   name: 'course',
  //   meta: {
  //     title: '课程管理',
  //     icon: 'el-icon-aim',
  //   },
  //   children: [
  //     {
  //       path: 'list',
  //       name: 'courseList',
  //       component: () => import('@/views/course/index'),
  //       meta: {
  //         title: '课程管理',
  //         icon: 'el-icon-aim'
  //       }
  //     },
  //     {
  //       path: 'edit',
  //       name: 'courseEdit',
  //       component: () => import('@/views/course/edit'),
  //       meta: {
  //         title: '编辑课程',
  //         icon: 'el-icon-picture-outline',
  //         activeMenu: '/course/list'
  //       },
  //       hidden: true,
  //     },
  //     {
  //       path: 'add',
  //       name: 'courseAdd',
  //       component: () => import('@/views/course/add'),
  //       meta: {
  //         title: '新建课程',
  //         icon: 'el-icon-picture-outline',
  //         activeMenu: '/course/list'
  //       },
  //       hidden: true,
  //     },
  //   ]
  // },

  // {
  //   path: '/column',
  //   component: Layout,
  //   redirect: '/column/list',
  //   name: 'column',
  //   meta: {
  //     title: '专栏管理',
  //     icon: 'el-icon-aim',
  //   },
  //   children: [
  //     {
  //       path: 'list',
  //       name: 'columnList',
  //       component: () => import('@/views/column/index'),
  //       meta: {
  //         title: '专栏管理',
  //         icon: 'el-icon-aim'
  //       }
  //     },
  //     {
  //       path: 'edit',
  //       name: 'columnEdit',
  //       component: () => import('@/views/column/edit'),
  //       meta: {
  //         title: '编辑专栏',
  //         icon: 'el-icon-picture-outline',
  //         activeMenu: '/column/list'
  //       },
  //       hidden: true,
  //     },
  //     {
  //       path: 'add',
  //       name: 'columnAdd',
  //       component: () => import('@/views/column/add'),
  //       meta: {
  //         title: '新建专栏',
  //         icon: 'el-icon-picture-outline',
  //         activeMenu: '/column/list'
  //       },
  //       hidden: true,
  //     },
  //     {
  //       path: 'classify',
  //       name: 'courseClassify',
  //       component: () => import('@/views/column/classify'),
  //       meta: {
  //         title: '分类管理',
  //         icon: 'el-icon-collection-tag',
  //       },
  //     },
  //   ]
  // },

  {
    path: '/repurchase',
    component: Layout,
    redirect: '/repurchase/goods',
    name: 'repurchase',
    meta: { title: '换购管理', icon: 'el-icon-document' },
    children: [
      {
        path: 'goods',
        name: 'repurchaseGoods',
        component: () => import('@/views/repurchase/goods'),
        meta: { title: '商品', icon: 'el-icon-document' }
      },
      // {
      //   path: 'classify',
      //   name: 'repurchaseClassify',
      //   component: () => import('@/views/repurchase/classify'),
      //   meta: { title: '分类', icon: 'el-icon-document' }
      // },
      {
        path: 'add',
        name: 'repurchaseAdd',
        component: () => import('@/views/repurchase/add'),
        meta: { title: '添加商品', icon: 'el-icon-document' },
        hidden: true,
      },
      {
        path: 'edit',
        name: 'repurchaseEdit',
        component: () => import('@/views/repurchase/edit'),
        meta: { title: '编辑商品', icon: 'el-icon-document' },
        hidden: true,
      },
      {
        path: 'order',
        name: 'repurchaseOrder',
        component: () => import('@/views/repurchase/order'),
        meta: { title: '订单', icon: 'el-icon-document' }
      },
    ]
  },

  // {
  //   path: '/example',
  //   component: Layout,
  //   redirect: '/example/table',
  //   name: 'Example',
  //   meta: { title: 'Example', icon: 'el-icon-s-help' },
  //   children: [
  //     {
  //       path: 'table',
  //       name: 'Table',
  //       component: () => import('@/views/table/index'),
  //       meta: { title: 'Table', icon: 'table' }
  //     },
  //     {
  //       path: 'tree',
  //       name: 'Tree',
  //       component: () => import('@/views/tree/index'),
  //       meta: { title: 'Tree', icon: 'tree' }
  //     }
  //   ]
  // },
  //
  // {
  //   path: '/form',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       name: 'Form',
  //       component: () => import('@/views/form/index'),
  //       meta: { title: 'Form', icon: 'form' }
  //     }
  //   ]
  // },
  //
  // {
  //   path: '/nested',
  //   component: Layout,
  //   redirect: '/nested/menu1',
  //   name: 'Nested',
  //   meta: {
  //     title: 'Nested',
  //     icon: 'nested'
  //   },
  //   children: [
  //     {
  //       path: 'menu1',
  //       component: () => import('@/views/nested/menu1/index'), // Parent router-view
  //       name: 'Menu1',
  //       meta: { title: 'Menu1' },
  //       children: [
  //         {
  //           path: 'menu1-1',
  //           component: () => import('@/views/nested/menu1/menu1-1'),
  //           name: 'Menu1-1',
  //           meta: { title: 'Menu1-1' }
  //         },
  //         {
  //           path: 'menu1-2',
  //           component: () => import('@/views/nested/menu1/menu1-2'),
  //           name: 'Menu1-2',
  //           meta: { title: 'Menu1-2' },
  //           children: [
  //             {
  //               path: 'menu1-2-1',
  //               component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'),
  //               name: 'Menu1-2-1',
  //               meta: { title: 'Menu1-2-1' }
  //             },
  //             {
  //               path: 'menu1-2-2',
  //               component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'),
  //               name: 'Menu1-2-2',
  //               meta: { title: 'Menu1-2-2' }
  //             }
  //           ]
  //         },
  //         {
  //           path: 'menu1-3',
  //           component: () => import('@/views/nested/menu1/menu1-3'),
  //           name: 'Menu1-3',
  //           meta: { title: 'Menu1-3' }
  //         }
  //       ]
  //     },
  //     {
  //       path: 'menu2',
  //       component: () => import('@/views/nested/menu2/index'),
  //       name: 'Menu2',
  //       meta: { title: 'menu2' }
  //     }
  //   ]
  // },

  // {
  //   path: 'external-link',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
  //       meta: { title: 'External Link', icon: 'link' }
  //     }
  //   ]
  // },

  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
